{template 'header'}
<style>
a{
	text-decoration: none;
}
.lists{
	width:100%;
	height:auto;
}
.l-item{
	width:94%;
	margin:0 3%;
	display:flex;
	display: -webkit-flex;
	border-bottom: 1px solid #eee;
	padding:10px 0;
	color:#333;
}
.l-item>img{
	width:60px;
	height:60px;
	margin-top:10px;
	border-radius:50%;
}
.l-item .l-center{
	flex:2;
	margin:10px 0;
	font-size:14px;
	line-height:30px;
	margin-left:5px;
	color:#333;
}
.l-item .l-center>div{
	overflow: hidden;
	color:#333;
}
.l-item .l-right{
	flex:1;
	text-align:right;
	margin:10px 0;
	font-size:17px;
	line-height:80px;
	color:#333;
}
.top_menu{
	width:100%;
	height:40px;
	line-height:40px;
	display:flex;
	display: -webkit-flex;
	border-bottom: 1px solid #eee;
	font-size:16px;
}
.top_menu .t-item{
	display:block;
	flex:1;
	-webkit-flex:1;
	color:#01bb94;
	text-align:center;
	border-left: 1px solid #01bb94;
	font-size:13px;
}
.top_menu .t-item:FIRST-CHILD{
	border: 0;
}
.top_menu .t-item.on{
	color:#fff;
	background:#01bb94;
}
</style>
{if $cfg['commission']['status']>1}
<div class="top_menu">
	<a href="{php echo $this->createMobileUrl('mynext', array('type'=>0))}" class="t-item {if empty($_GPC['type'])}on{/if}">一级队员({if empty($total)}0{else}{$total}{/if})</a>
	<a href="{php echo $this->createMobileUrl('mynext', array('type'=>1))}" class="t-item {if $_GPC['type']==1}on{/if}">二级队员({if empty($second)}0{else}{$second}{/if})</a>
	{if $cfg['commission']['status']>2}<a href="{php echo $this->createMobileUrl('mynext', array('type'=>2))}" class="t-item {if $_GPC['type']==2}on{/if}">三级队员({if empty($third)}0{else}{$third}{/if})</a>{/if}
</div>
{/if}
<div class="lists" id="lists">

</div>
<div style="height:60px;width:100%;"></div>
{template 'loading'}
{template 'footer'}
<script>
$(function(){
	getList();
});

var page = 1;
//下拉加载
var range = -80; //距下边界长度/单位px
var totalheight = 0;
var loading = false;
$(window).scroll(function () {
	//真实内容的高度
	var pageHeight = Math.max(document.body.scrollHeight,document.body.offsetHeight);
	//视窗的高度
	var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
	//隐藏的高度
	var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
	 if(pageHeight - viewportHeight - scrollHeight < 10){  //如果满足触发条件，执行
	  		if(loading) return false;
			page++;
			getList();
	  }
});
function getList(){
	if(loading) return false;
	loading = true;
	LOADING(true)
	$.ajax({
		url: "{php echo $this->createMobileUrl('getmynext',array('type'=>$_GPC['type'],'mid'=>$mem['id']))}",
		data: {page:page,scroll:true},
		type: "post",
		success: function(dat){
			LOADING(false)
			dat = JSON.parse(dat);
			if(dat.status==1){
				dat = dat.lists;
				var str = '';
				for(var i in dat){
					
					str += '<div class="l-item">';
					str += '<img src="'+dat[i].avatar+'" />';
					str += '<div class="l-center">';
					str += '<div>'+dat[i].nickname+'</div>';
					str += '<div>'+dat[i].createtime+'</div>';
					str += '</div>';
					str += '<div class="l-right">';
					if(dat[i].haspay) str += '<div style="color:green">已购买</div>';
					else str += '<div style="color:red">未购买</div>';
					str += '</div>';
					str += '</div>';
					
				}
				$('#lists').append(str);
				loading = false;
			}
			else{
				loading = true;
			}
		}	
	});	
}
</script>

</body>
</html>